package com.sx.zongzhi.adapter;


import android.content.Context;
import android.view.View;
import android.widget.TextView;

import com.sx.zongzhi.R;
import com.sx.zongzhi.bean.ServiceObjectBean;
import com.zhy.adapter.abslistview.CommonAdapter;
import com.zhy.adapter.abslistview.ViewHolder;

import java.util.List;

/**
 * Created by XZY on 2017/11/23.
 * 服务对象选择
 */
public class ServiceObjSelectAdapter extends CommonAdapter<ServiceObjectBean.RowsBean> {

    private int type;
    public ServiceObjSelectAdapter(Context context, int layoutId, List<ServiceObjectBean.RowsBean> datas) {
        super(context, layoutId, datas);
    }

    public void setType(int type){
        this.type=type;
    }

    @Override
    protected void convert(ViewHolder viewHolder, final ServiceObjectBean.RowsBean item, int position) {

        TextView phone=viewHolder.getView(R.id.tv_Phone);
        viewHolder.setText(R.id.checkbox,item.getObjectName());
        if (type==1){
            phone.setVisibility(View.VISIBLE);
            phone.setText(item.getIdCardNo());
        }else if (type==3){
            phone.setVisibility(View.VISIBLE);
            phone.setText(item.getName());
        }else{//type=2
            phone.setVisibility(View.GONE);
        }
    }
}
